<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Gets the keywords for the input locale</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="locale.getdisplayvariant.html">« Locale::getDisplayVariant</a></li>
      <li style="float: right;"><a href="locale.getprimarylanguage.html">Locale::getPrimaryLanguage »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="class.locale.html">Locale</a></li>
    <li>Gets the keywords for the input locale</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="locale.getkeywords" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">Locale::getKeywords</h1>
  <h1 class="refname">locale_get_keywords</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.3.0, PHP 7, PHP 8, PECL intl &gt;= 1.0.0)</p><p class="refpurpose"><span class="refname">Locale::getKeywords</span> -- <span class="refname">locale_get_keywords</span> &mdash; <span class="dc-title">Gets the keywords for the input locale</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-locale.getkeywords-description">
  <h3 class="title">说明</h3>
  <p class="para">
   面向对象风格
  </p>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="modifier">static</span> <span class="methodname"><strong>Locale::getKeywords</strong></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$locale</code></span>): <span class="type"><span class="type">array</span>|<span class="type"><span class="type false">false</span></span>|<span class="type">null</span></span></div>

  <p class="para rdfs-comment">
   过程化风格
  </p>
  <div class="methodsynopsis dc-description"><span class="methodname"><strong>locale_get_keywords</strong></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$locale</code></span>): <span class="type"><span class="type">array</span>|<span class="type"><span class="type false">false</span></span>|<span class="type">null</span></span></div>

  <p class="para rdfs-comment">
   Gets the keywords for the input locale.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-locale.getkeywords-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>
    
     <dt>
<code class="parameter">locale</code></dt>

     <dd>

      <p class="para">
       The locale to extract the keywords from
      </p>
     </dd>

    
   </dl>

  </p>
 </div>



 <div class="refsect1 returnvalues" id="refsect1-locale.getkeywords-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Associative <span class="type">array</span> containing the keyword-value pairs for this locale
  </p>
  <p class="para">当 <code class="parameter">locale</code> 的长度超过 <strong><code>INTL_MAX_LOCALE_LEN</code></strong> 时返回 <strong><code>null</code></strong>。</p>
 </div>


 <div class="refsect1 examples" id="refsect1-locale.getkeywords-examples">
  <h3 class="title">范例</h3>
  <div class="example" id="example-2348">
   <p><strong>示例 #1 <span class="function"><strong>locale_get_keywords()</strong></span> example</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$keywords_arr&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">locale_get_keywords</span><span style="color: #007700">(</span><span style="color: #DD0000">'de_DE@currency=EUR;collation=PHONEBOOK'</span><span style="color: #007700">);<br />if&nbsp;(</span><span style="color: #0000BB">$keywords_arr</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;foreach&nbsp;(</span><span style="color: #0000BB">$keywords_arr&nbsp;</span><span style="color: #007700">as&nbsp;</span><span style="color: #0000BB">$key&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">$value</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"</span><span style="color: #0000BB">$key</span><span style="color: #DD0000">&nbsp;=&nbsp;</span><span style="color: #0000BB">$value</span><span style="color: #DD0000">\n"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />}<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
   </div>

  </div>
  <div class="example" id="example-2349">
   <p><strong>示例 #2 OO example</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$keywords_arr&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">Locale</span><span style="color: #007700">::</span><span style="color: #0000BB">getKeywords</span><span style="color: #007700">(</span><span style="color: #DD0000">'de_DE@currency=EUR;collation=PHONEBOOK'</span><span style="color: #007700">);<br />if&nbsp;(</span><span style="color: #0000BB">$keywords_arr</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;foreach&nbsp;(</span><span style="color: #0000BB">$keywords_arr&nbsp;</span><span style="color: #007700">as&nbsp;</span><span style="color: #0000BB">$key&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">$value</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"</span><span style="color: #0000BB">$key</span><span style="color: #DD0000">&nbsp;=&nbsp;</span><span style="color: #0000BB">$value</span><span style="color: #DD0000">\n"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />}<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
   </div>

  </div>
  <p class="para">以上例程会输出：</p>
  <div class="example-contents screen">
<div class="cdata"><pre>
collation = PHONEBOOK
currency = EUR
</pre></div>
  </div>
 </div>


 <div class="refsect1 seealso" id="refsect1-locale.getkeywords-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="locale.getallvariants.html" class="function" rel="rdfs-seeAlso">locale_get_all_variants()</a> - Gets the variants for the input locale</span></li>
   </ul>
  </p>
 </div>

</div></div></div></body></html>